<template>
  <iframe id="iframe" ref="iframe" :src="addr" style="width: 100% ;height: 800px; border: none"></iframe>
</template>
<script>
let _this;
export default {
  name: "myIframe",
  model: {
    prop: "myData",
    event: "iframeChange",
  },
  props: {
    myData: {
      type: Object,
      default: () => {
      },
    },
  },
  watch: {
    myData: {
      handler(val) {
        this.urlHandler(val)
      },
      immediate: true,  //刷新加载 立马触发一次handler
      deep: true
    }
  },
  data: function () {
    return {
      addr: "",
    }
  },
  created() {
  },
  mounted() {
  },

  methods: {
    // 处理url
    urlHandler(value) {
      if (value && value != ""){
        if (value.ip != "" && value.port != "" && value.url != "") {
          this.addr = "http://" + value.ip + ":" + value.port + value.url
        }
      }
    }
  }
}
</script>

<style lang="less" scoped>
::v-deep {
  .el-dialog__body {
    padding: 0px 0px !important;
  }
}
</style>
